#include <59header.h>

/* Usage: ./03_chdir dirname  */
int main(int argc, char *argv[]){
    ARGS_CHECK(argc, 2);
    char curr_path[1024] = {0};
    char *ret = getcwd(curr_path, sizeof(curr_path));
    ERROR_CHECK(ret, NULL, "getcwd");
    printf("一开始的工作目录是:%s\n", curr_path);


    // 改变当前工作目录
    int ret2 = chdir(argv[1]);
    ERROR_CHECK(ret2, -1, "chdir");

    // 再次打印当前工作目录
    char *ret3 = getcwd(curr_path, sizeof(curr_path));
    ERROR_CHECK(ret3, NULL, "getcwd");
    printf("切换工作目录以后的工作目录是:%s\n", curr_path);
        

    return 0;
}

